<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Star {
            // 1. constructor 里面的this 指向的是创建 new 的实例对象
            constructor(name, age){
                this.name = name 
                this.age = age 
                console.log(this)
            }
            // 2. 类的方法内部，如果含有this， 它默认指向的是类的实例
            sing(song){
                console.log(song)
                console.log(this)
            }
            dance(){
                console.log('跳舞')
            }
        }

        const handsome = new Star('航桑', 19)
        // console.log()
        handsome.sing('冰雨')

    </script>
</body>
</html>